package factory

// 计算器
type operator interface {
	result(a, b int) int
}

type operatorFactory interface {
	create() operator
}

type plusOprator struct{}

func (p *plusOprator) result(a, b int) int {
	return a + b
}

type minusOprator struct{}

func (m *minusOprator) result(a, b int) int {
	return a - b
}

type plusOperatorFactory struct {
	*plusOprator
}

func (pf *plusOperatorFactory) create() operator {
	return pf.plusOprator
}

type minusOpratorFactory struct {
	*minusOprator
}

func (mf *minusOpratorFactory) create() operator {
	return mf.minusOprator
}
